package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.common.entity.QueryPageBean;
import com.itheima.pojo.Setmeal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.io.File;
import java.util.List;
import java.util.Map;

@Mapper
public interface SetmealMapper {

    /**
     * 新增套餐
     * @param setmeal
     */
    Integer add(Setmeal setmeal);

    /**
     * 编辑套餐
     * @param setmeal
     */
    void edit(Setmeal setmeal);

    /**
     * 根据id查询套餐
     * @param id
     * @return
     */
    @Select("select * from t_setmeal where id = #{id}")
    Setmeal findById(String id);

    /**
     * 分页查询
     * @param queryPageBean
     * @return
     */
    Page<Setmeal> findPage(QueryPageBean queryPageBean);


    void setSetmealAndCheckGroup(List<Map<String, Integer>> maps);

    @Delete("delete from t_setmeal_checkgroup where setmeal_id = #{id}")
    void deleteSetmealAndCheckGroup(Integer id);

    /**
     * 查询套餐占比
     * @return
     */
    List<Map<String, Object>> findSetmealCount();

}
